home *** CD-ROM | disk | FTP | other *** search
/ PC Home 49 / PC_Home_Issue_49.iso / lldemo / lldemo.shr / ROSETTA.EXE / ROSETTA.DXR / 00580_text alignment scripts.ls < prev    next >
Encoding:
Text File  |  1996-06-24  |  4.0 KB  |  137 lines

  1. on centerVert snum, t, sh, mh, wButton
  2.   if wButton <> #NONE then
  3.     if (sh < (mh - 35)) and (sh > (mh - 70)) then
  4.       if wButton = #top then
  5.         set t to t + 35
  6.       end if
  7.       set mh to mh - 35
  8.       set value to 0
  9.     else
  10.       set value to sh > (mh - 35)
  11.     end if
  12.   else
  13.     set value to 0
  14.   end if
  15.   set hdiff to (mh - sh) / 2
  16.   spriteBox(snum, 1000, t + hdiff, 1000 + the width of sprite snum, t + sh + hdiff)
  17.   return value
  18. end
  19.  
  20. on alignChallenge ChallengeIndex, ChallengeOrder, page, NormSize, blindfold
  21.   global gScreenMode, gType
  22.   if getaProp(gScreenMode, #TXTRESP) = #ALONE then
  23.     set TextCast to 113
  24.   else
  25.     set TextCast to 49
  26.   end if
  27.   set index to value(char ChallengeIndex of ChallengeOrder) + ((page - 1) * 4)
  28.   if getaProp(gScreenMode, #TXTCHAL) = #ONPCT then
  29.     hide9()
  30.     updateStage()
  31.     set the text of cast (TextCast - 5) to the text of cast (344 + index)
  32.     set the textSize of cast (TextCast - 5) to NormSize
  33.     if gType = #PC then
  34.       set the textHeight of cast (TextCast - 5) to NormSize + 2
  35.     end if
  36.     if blindfold then
  37.       alignText(10, TextCast - 5, 2, 160, 1, #bottom)
  38.     else
  39.       alignText(10, TextCast - 5, 2, 160, 1, #NONE)
  40.     end if
  41.   else
  42.     hide7()
  43.     updateStage()
  44.     set the text of cast (TextCast - 6) to the text of cast (344 + index)
  45.     set the textSize of cast (TextCast - 6) to NormSize
  46.     if gType = #PC then
  47.       set the textHeight of cast (TextCast - 6) to NormSize + 2
  48.     end if
  49.     alignText(8, TextCast - 6, 1, 57, 0, #NONE)
  50.   end if
  51. end
  52.  
  53. on alignText snum, cnum, t, mh, tryCenter, wButton
  54.   global gSmallSize, gType
  55.   set sh to the bottom of sprite snum - the top of sprite snum
  56.   if sh > mh then
  57.     set the textSize of cast cnum to gSmallSize
  58.     if gType = #PC then
  59.       set the textHeight of cast cnum to gSmallSize + 2
  60.     end if
  61.     set sh to the bottom of sprite snum - the top of sprite snum
  62.     set whatisthis to centerVert(snum, t, sh, mh, wButton)
  63.   else
  64.     if wButton <> #NONE then
  65.       if sh > (mh - 35) then
  66.         set the textSize of cast cnum to gSmallSize
  67.         if gType = #PC then
  68.           set the textHeight of cast cnum to gSmallSize + 2
  69.         end if
  70.         set sh to the bottom of sprite snum - the top of sprite snum
  71.       end if
  72.     end if
  73.     set whatisthis to centerVert(snum, t, sh, mh, wButton)
  74.   end if
  75.   if tryCenter then
  76.     if sh <= 22 then
  77.       set the textAlign of field cnum to "center"
  78.     else
  79.       set the textAlign of field cnum to "left"
  80.     end if
  81.   end if
  82.   put RETURN after field cnum
  83. end
  84.  
  85. on alignResponse which, ResponseOrder, page, NormSize
  86.   global gScreenMode, gType
  87.   if getaProp(gScreenMode, #TXTRESP) = #ALONE then
  88.     set TextCast to 113
  89.   else
  90.     set TextCast to 49
  91.   end if
  92.   if getaProp(gScreenMode, #SNDRESP) <> #NONE then
  93.     set Botlocs to "#BOTTOM,#BOTTOM,#TOP,#TOP"
  94.   else
  95.     set Botlocs to "#NONE,#NONE,#NONE,#NONE"
  96.   end if
  97.   if getaProp(gScreenMode, #SCREEN) = #TYPE1 then
  98.     set Tops to "58,58,222,222"
  99.     set h to 160
  100.   else
  101.     set Tops to "169,169,278,278"
  102.     set h to 105
  103.   end if
  104.   if which = 0 then
  105.     hideTextPuppets()
  106.     set st to 0
  107.     set en to 3
  108.   else
  109.     hideTextPuppet(which)
  110.     set st to which - 1
  111.     set en to which - 1
  112.   end if
  113.   updateStage()
  114.   set base to (page - 1) * 4
  115.   repeat with i = st to en
  116.     set index to value(char i + 1 of ResponseOrder) + base
  117.     set the text of cast (TextCast + i) to the text of cast (344 + index)
  118.     set the textSize of cast (TextCast + i) to NormSize
  119.     if gType = #PC then
  120.       set the textHeight of cast (TextCast + i) to NormSize + 2
  121.     end if
  122.     alignText(8 + i, TextCast + i, value(item i + 1 of Tops), h, 1, value(item i + 1 of Botlocs))
  123.     showTextPuppet(i + 1)
  124.   end repeat
  125. end
  126.  
  127. on drawText
  128.   global gScreenMode, gResponseOrder, gPage, gNormSize, gChallengeIndex, gChallengeOrder, gBlindfold
  129.   if getaProp(gScreenMode, #TXTRESP) <> #NONE then
  130.     alignResponse(0, gResponseOrder, gPage, gNormSize)
  131.   else
  132.     if getaProp(gScreenMode, #TXTCHAL) <> #NONE then
  133.       alignChallenge(gChallengeIndex, gChallengeOrder, gPage, gNormSize, gBlindfold)
  134.     end if
  135.   end if
  136. end
  137.